import 'package:base_flutter/base_flutter.dart';
import 'package:ls_work/net/response/warning_type_list_data.dart';

import '../../net/api/http_api.dart';

class WarningModel extends BaseMvvmModel{
  @override
  void onCleared() {
  }

  ///获取报警类型列表
  Future<List<WarningTypeListData>> getWarningTypeList() async {
    var data = await HttpGo.instance.postData(HttpApi.warningTypeList,data: {});
    if("0"==data['code']){
      return ((data['data'] as List)??[]).map((e) => WarningTypeListData.fromJson(e)).toList();
    }else{
      throw data['msg'];
    }
  }
}